package cn.com.infosec.ra.dao.entusercertdao;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import cn.com.infosec.ra.entity.EntUserCertEntity;
import cn.com.infosec.ra.entity.PerUserCertEntity;
import cn.com.infosec.ra.util.Pagination;

public interface EntUserCertDao {
	public void addEntUserCert(EntUserCertEntity entUserCertEntity);

	@Select("select * from INS_Enterprise where businessenterprisenum1 =#{businessenterprisenum1}")
	public EntUserCertEntity findUserCertByEnterprisenum(
			String businessenterprisenum1);

	@Select("select * from INS_Enterprise where certdn =#{certdn}")
	public EntUserCertEntity findEntUserCertByCertDN(String certdn);

	public void updateEntUserCertbyCertDN(EntUserCertEntity entUserCert);

	@Select("select * from INS_Enterprise where businessenterprisetype1 =#{businessenterprisetype1} "
			+ "and businessenterprisenum1 = #{businessenterprisenum1} and cardtype = #{cardtype} "
			+ "and cardnum = #{cardnum}")
	public EntUserCertEntity findUserCert(
			@Param(value = "businessenterprisetype1") int businessenterprisetype1,
			@Param(value = "businessenterprisenum1") String businessenterprisenum1,
			@Param(value = "cardtype") int cardtype,
			@Param(value = "cardnum") String cardnum);

	@Select("select * from INS_Enterprise where certsn =#{certsn}")
	public EntUserCertEntity findEntUserCertByCertSN(String certsn);

	public void updateEntUserCertbyId(EntUserCertEntity entUserCert);

	public List<EntUserCertEntity> queryUserCertUnCheckedByPager(
			@Param(value = "entUserCertList") Pagination<EntUserCertEntity> entUserCertList,
			@Param(value = "organId") int organId);

	@Select("select * from INS_Enterprise where checkStatus != 99 and organId =#{organId}")
	public List<EntUserCertEntity> queryUserCertUnChecked(int organId);

	public List<EntUserCertEntity> queryEntUserCertByConditionsInPager(
			@Param(value = "entUserCertConmand") EntUserCertEntity entUserCertConmand,
			@Param(value = "entUserCertList") Pagination<EntUserCertEntity> entUserCertList,
			@Param(value = "endTime") String endTime,
			@Param(value = "beginTime") String beginTime,
			@Param(value = "organId") int organId,
			@Param(value = "oprAccount") String oprAccount);

	public List<PerUserCertEntity> queryEntUserCertByConditions(
			@Param(value = "entUserCertConmand") EntUserCertEntity entUserCertConmand,
			@Param(value = "endTime") String endTime,
			@Param(value = "beginTime") String beginTime,
			@Param(value = "organId") int organId,
			@Param(value = "oprAccount") String oprAccount);

	@Select("select * from INS_Enterprise where id =#{id}")
	public EntUserCertEntity findEntUserCertById(Long id);

	public void updateEntUserCertBaseInfo(EntUserCertEntity entUserCertCommand);

	public void addEntUserCertOracle(EntUserCertEntity entUserCertCommand);

	public List<EntUserCertEntity> queryUserCertUnCheckedByPagerOracle(
			@Param(value = "entUserCertList") Pagination<EntUserCertEntity> entUserCertList,
			@Param(value = "organId") int organId);

	public List<EntUserCertEntity> queryEntUserCertByConditionsInPagerOracle(
			@Param(value = "entUserCertConmand") EntUserCertEntity entUserCertConmand,
			@Param(value = "entUserCertList") Pagination<EntUserCertEntity> entUserCertList,
			@Param(value = "endTime") String endTime,
			@Param(value = "beginTime") String beginTime,
			@Param(value = "organId") int organId,
			@Param(value = "oprAccount") String oprAccount);
}
